<style>
    .pageFormContent dd {
    display: block;
    float: none;
    line-height: 21px;
    width: 450px;
}
</style>
<form id="pagerForm" action="{:U($module_name.'/'.$action_name)}">
    <input type="hidden" name="pageNum" value="{$pageNum}" />
    <input type="hidden" name="numPerPage" value="{$numPerPage}" />
    <input type="hidden" name="id" value="{$_REQUEST ['id']}" />
</form>
<div class="pageContent">
    <table class="table" layoutH="200" targetType="dialog" width="100%">
        <thead>
            <tr>
                <th>ID</th>
                <th>主帐户ID</th>
                <th>主区域</th>
                <th>附属帐户ID</th>
                <th>附属区域</th>
                <th>操作用户ID</th>
                <th>关联时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
            <tr>
                <td>{$vo['id']}</td>
                <td>{$vo['primary_agent_id']}</td>
                <td>{$Area[$vo['primary_area']]['name']}</td>
                <td>{$vo['deputy_agent_id']}</td>
                <td>{$Area[$vo['deputy_area']]['name']}</td>
                <td>{$vo['action_userid']}</td>
                <td>{$vo['ctime']}</td>
                <td><a title="删除" target="ajaxTodo" href="{:U('Agent/attacheddel',array('id'=>$vo['id'],'agentid'=>$vo['primary_agent_id'],'province'=>$_REQUEST['province'],'city'=>$_REQUEST['city'],'area'=>$_REQUEST['area']))}">删除</a></td>
            </tr>
        </volist>
        </tbody>
    </table>

    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
        <select class="combox" name="numPerPage" onchange="navTabPageBreak({targetType:dialog,numPerPage:this.value})">
            <option value="5" {if $numPerPage==5}selected="selected"{/if}>5</option>
            <option value="10" {if $numPerPage==10}selected="selected"{/if}>10</option>
            <option value="20" {if $numPerPage==20}selected="selected"{/if}>20</option>
        </select>
        <span>条，共{$totalCount}条</span>
        </div>
        <div class="pagination" targetType="dialog" totalCount="{$totalCount}" numPerPage="{$numPerPage}" pageNumShown="10" currentPage="{$pageNum}"></div>
    </div>
</div>
<div class="pageContent">
    <form method="post" action="{:U('Agent/attached',array('id'=>$_REQUEST[id],'province'=>$_REQUEST['province'],'city'=>$_REQUEST['city'],'area'=>$_REQUEST['area']))}" onsubmit="return validateCallback(this,dialogAjaxDone2);">
    	<div class="tabsContent">
            <div class="pageFormContent" layouth="220">
        		<dl>
                    <dt>专营商公司：</dt>
                    <dd>
                        <input name="Agent.user_id" value="" type="hidden"/> 
                        <input name="Agent.vesting_province" value="" type="hidden"/>
                        <input name="Agent.vesting_city" value="" type="hidden"/>
                        <input name="Agent.vesting_area" value="" type="hidden"/>
                        <input name="Agent.company" value="" type="text" readonly="true"/> 
                  </dd>
                </dl>
                <dl>
                    <dt>联系人：</dt>
                    <dd>
                        <input name="Agent.realname" value="" type="text" readonly="true"/>
                  </dd>
                </dl>
                <dl>
                    <dt>手机号：</dt>
                    <dd>
                        <input name="Agent.mobile" value="" type="text" readonly="true"/>
                        <a class="btnLook" href="{:U('Agent/lookup',array('tn'=>'user_agent','fn'=>'id','field'=>'id,user_id,stype,company,realname,mobile,vesting_province,vesting_city,vesting_area'))}" lookupGroup="Agent">查找分类</a>
                        <span class="info">查看专营商</span>
                  </dd>
                </dl>
            </div>
    	</div>
    	<div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent">
                    <input id="dosubmit" name="dosubmit" type="hidden" value="1"/>
                    <button type="submit">保存</button></div></div>
                </li>
                <li>
                    <div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
                </li>
            </ul>
        </div>
        <div class="tabsFooter">
            <div class="tabsFooterContent"></div>
        </div>
    </form>
</div>
<script>
    function dialogAjaxDone2(json){
    DWZ.ajaxDone(json);
    if (json.statusCode == DWZ.statusCode.ok){
        if (json.navTabId){
            navTab.reload(json.forwardUrl, {navTabId: json.navTabId});
        } else if (json.rel) {
            var $pagerForm = $("#pagerForm", navTab.getCurrentPanel());
            var args = $pagerForm.size()>0 ? $pagerForm.serializeArray() : {}
            navTabPageBreak(args, json.rel);
        }else if(json.dialogId){
            //$.pdialog.closeCurrent();
            $.pdialog.reload(json.forwardUrl,{dialogId:json.dialogId});
        }
        if ("closeCurrent" == json.callbackType) {
            if(json.forwardUrl){
                navTab.reload(json.forwardUrl);
            }
            $.pdialog.closeCurrent();
        }
    }
}
</script>